#pragma once

#include "Misc/EngineEditorMacros.h"
#include "Object/Object.h"
#include "Math/IntPoint.h"
#include "Framework/Tickable.h"
#include "EditorPopupMenuView.m.h"

class RWindow;
class RWidget;

RCLASS()
class REditorPopupMenuView : public RObject, public ITickable
{
    ROBJECT

public:

    TSharedObjectPtr<RWidget> ShowPopupMenu(
        const SIntPoint & InMeneSize
        ,TSharedObjectPtr<RWidget> InWidgetToAround
        );

    void ClosePopupMenu();

protected:
    TSharedObjectPtr<RWindow> PopupWindow;
    TWeakObjectPtr<RWidget> WidgetToAroundWeak;
    SIntPoint MenuSize;
    bool bIsClosed=true;

    virtual void Tick(float DeltaSeconds) override;
    void UpdatePopupWindowPosition();
};